<%@ include file="/jsps/main.jsp"%>

<%
long songId = ParamUtil.getLong(request, "songId");
Song song = null;
if(songId > 0) {
	song = SongLocalServiceUtil.getSong(songId);
}
PortletURL renderUrl = renderResponse.createRenderURL();
PortletURL redirectUrl = renderResponse.createRenderURL();
PortletURL actionUrl = renderResponse.createActionURL();
actionUrl.setParameter("redirectUrl", redirectUrl.toString());
%>

<aui:layout cssClass="portlet-layout">
	<aui:column cssClass="aui-w20 portlet-column portlet-column-first">
		<div class="portlet-column-content portlet-column-content-first">
			<ul class="karaoke-menu">
				<%
				renderUrl.setParameter("jspPage", "/jsps/quan-tri/list.jsp");
				%>
				<li><a href="<%=renderUrl.toString()%>"><liferay-ui:message key="danh-sach-cac-bai-hat"/></a></li>
				
				<%
				renderUrl.setParameter("jspPage", "/jsps/quan-tri/update.jsp");
				%>
				<li><a href="<%=renderUrl.toString()%>"><liferay-ui:message key="tao-bai-hat"/></a></li>
				
				<c:if test="<%= song != null %>">
					<%
					renderUrl.setParameter("songId", String.valueOf(songId));
					%>
					<li><a href="<%=renderUrl.toString()%>"><liferay-ui:message key="cap-nhap-bai-hat"/></a></li>
					
					<%
					actionUrl.setParameter("songId", String.valueOf(songId));
					actionUrl.setParameter(ActionRequest.ACTION_NAME, "deleteSong");
					%>
					<li><a href="<%=actionUrl.toString()%>"><liferay-ui:message key="xoa-bai-hat"/></a></li>
				</c:if>
			</ul>
		</div>
			
	</aui:column>
	<aui:column cssClass="aui-w80 portlet-column portlet-column-last">
		<div class="portlet-column-content portlet-column-content-last">
			<c:choose>
				<c:when test="<%= song == null %>">
					<div class="portlet-msg-error"><liferay-ui:message key="no-song-found"/></div>
				</c:when>
				<c:otherwise>
					<table class="table song-table">
						<tr>
							<th><liferay-ui:message key="songId"/></th>
							<td><%=song.getSongId() %></td>
						</tr>
						<tr>
							<th><liferay-ui:message key="songName"/></th>
							<td><%=song.getSongName() %></td>
						</tr>
						<tr>
							<th><liferay-ui:message key="songAuthor"/></th>
							<td><%=song.getSongAuthor() %></td>
						</tr>
						<tr>
							<th><liferay-ui:message key="songCategory"/></th>
							<td><%=song.getSongCategory() %></td>
						</tr>
						<tr>
							<th><liferay-ui:message key="songSinger"/></th>
							<td><%=song.getSongSinger() %></td>
						</tr>
						<tr>
							<th><liferay-ui:message key="recordNumber"/></th>
							<td><%=String.valueOf(song.getRecordNumber()) %></td>
						</tr>
							<tr>
							<th><liferay-ui:message key="songAudioUrl"/></th>
							<td><%=String.valueOf(song.getAudioUrl()) %></td>
						</tr>
							<tr>
							<th><liferay-ui:message key="songLyricData"/></th>
							<td><%=String.valueOf(song.getSongUrl()) %></td>
						</tr>
					</table>
				</c:otherwise>
			</c:choose>
		</div>
	</aui:column>
</aui:layout>